from playwright.async_api import BrowserContext


# 代理配置
proxy = {
    'server': 'http://127.0.0.1:7890',
    # 'username': '',
    # 'password': ''
}


async def ip(browser: BrowserContext):
    print('访问 ip 页面 开始')
    page = await browser.new_page()
    await page.goto('https://httpbin.org/ip', timeout=120000)
    content = await page.locator("xpath=/html/body/pre").text_content()
    print('代理 ip 为 %s' % content)
    print('访问 ip 页面 结束')
